#include "confess.h"
#include "ui_confess.h"

Confess::Confess(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Confess)
{
    ui->setupUi(this);

    srand(time(nullptr));
}

Confess::~Confess()
{
    delete ui;
}

void Confess::on_yes_clicked()
{
    ui->label->setText("我就知道！！！！");
}

void Confess::on_no_pressed()
{
    // 获取窗口大小
    int width = this->geometry().width();
    int height = this->geometry().height();
    // 随机获取按钮新位置
    int x = rand() % width + 1;
    int y = rand() % height + 1;
    // 移动按钮位置
    ui->no->move(x, y);
}
